const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
    app.use(
        '/api',
        createProxyMiddleware({
            //target: 'http://localhost:9086', // 修改为不带'/pe'   //cloud
            //target: 'http://localhost:8083/pe',
            target:'http://localhost:8085/pe',
            //target: 'http://192.168.202.102:30083/pe', // 修改为不带'/pe'   //k8s
            changeOrigin: true,
            pathRewrite: {'^/api': ''}, // 这里将'/api'替换为'/pe'
        })
    );
    app.use(
        '/api2',
        createProxyMiddleware({
            target: 'https://api.coze.cn/v3', // 修改为不带'/pe'
            changeOrigin: true,
            pathRewrite: {'^/api2': ''}, // 这里将'/api'替换为'/pe'
        })
    );
};